﻿using System;
using Business;

namespace TimeWork.report
{
    public partial class Charts : System.Web.UI.Page
    {
        private static int projectID;
        private string getParam()
        {
            if (Request.QueryString["pid"] != null)
            {
                return Request.QueryString["pid"].ToString();
            }
            else
            {
                return "0";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["email"] == null)
            {
                Response.Redirect("http://"+Request.Url.Authority+"/Login.aspx");
            }
            if (!IsPostBack)
            {
                projectID = Int32.Parse(getParam());
                if (projectID != 0)
                {
                    loadAccumulate();
                }
                else
                {
                    Response.Redirect("~/Dashboard.aspx");
                }
            }
        }

        private void loadAccumulate()
        {
            imgAccumulate.ImageUrl = BuChart.selChartAcc(projectID, Session["companyid"].ToString());
            lblAccumulate.Text = BuProject.selProjectByID(projectID, Session["companyid"].ToString()).projectName + " - Thời gian tích lũy";
        }
    }
}